CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR)

CMAKE_POLICY(SET CMP0043 NEW )
CMAKE_POLICY(SET CMP0020 NEW )

PROJECT(BlueMoon)

SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on window")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows" )
SET(CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "add a postfix, usually empty on windows")
SET(CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "add a postfix, usually empty on windows")

SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)

OPTION(USE_QT5 "Enable qt5" ON )

SET(CMAKE_ADDTION_LIBRARIES "" CACHE STRING "add other win system lib, splite with ' '" )

#SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_ADDTION_LIBRARIES} ws2_32.lib")
#SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_ADDTION_LIBRARIES} ws2_32.lib")

SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")

OPTION(BUILD_AT_UNICODE "build project at unicode env" "ON")

OPTION(BUILD_WITH_PCH "Enable use of precomplied headers, experimental" OFF)

INCLUDE(UtilityMacros)
INCLUDE(PlatformConfiguration)
INCLUDE(PCHMacros)


SET(BLUEMOON_SOURCE_DIR ${PROJECT_SOURCE_DIR})

FIND_PACKAGE(OSG REQUIRED)

IF(USE_QT5)
  FIND_PACKAGE(Qt5Widgets REQUIRED)
ENDIF(USE_QT5)

IF ( NOT Qt5Widgets_FOUND )
    FIND_PACKAGE(Qt4)
        IF (NOT QT4_FOUND)
        FIND_PACKAGE(Qt3)
    ENDIF()
ENDIF()

SET(QTMocFileGroupName "CMake Rules")



#SET(VSP_PLUGINS_DIR "stplugins" CACHE STRING "plugin install dir")
#MESSAGE("plugin will install to ${VSP_PLUGINS_DIR}")


IF( BUILD_WITH_PCH )
  ADD_DEFINITIONS(-DDT_USE_PCH)
ENDIF(BUILD_WITH_PCH)

INCLUDE_DIRECTORIES(
  ${OSG_INCLUDE_DIR}
  ${DELTA3D_INCLUDE_DIR}
  ${BLUEMOON_SOURCE_DIR}/include
  )


SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} CACHE STRING "YOU MAY ADD ADDITIONAL SEARCH PATHS HERE. USE ; TO SEPARATE MULTIPLE PATHS.")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} CACHE STRING "YOU MAY ADD ADDITIONAL SEARCH PATHS HERE. USE ; TO SEPARATE MULTIPLE PATHS.")

SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "(EXPERIMENTAL) YOU MAY ADD ADDITIONAL SEARCH PATHS HERE. USE ; TO SEPARATE MULTIPLE PATHS.")

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(application)
